package com.leetcode.August;

/**
 * @Description: 151. 反转字符串中的单词
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-21 12:52
 */
public class LC151反转字符串中的单词 {
    public String reverseWords(String s) {
        String[] ss = s.trim().split(" ");
        StringBuilder sb = new StringBuilder();
        for (int i = ss.length - 1; i >=0 ; i--) {
            if (ss[i]=="")continue;
            sb.append(ss[i]).append(" ");
        }
        return sb.toString().trim();
    }
}
